using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Configuration;
using System.Collections.Generic;
using System.Text;

namespace com.YiXiong.Store
{
    public class FileStore
    {

        public static bool Exists(string file)
        {
            return File.Exists(@file);
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        public static void Write(string file, string content)
        {
            string d = file.Substring(0, file.LastIndexOf("\\"));
            try
            {
                if (!Exists(file))
                {

                    if (!Directory.Exists(d))
                    {
                        Directory.CreateDirectory(d);
                    }
                    // Create a file to write to.
                    // try
                    // {
                    using (StreamWriter sw = File.CreateText(@file))
                    {
                        sw.Write(content);
                    }
                    //  }
                    /* catch (Exception e)
                     {
                         throw e.Me
                         return;
                     }
                     */

                }
            }
            catch (Exception e)
            {
                com.YiXiong.Util.Log.WriteEventLog(file);
            }
        }
    }
}
